local nya__liuli = fk.CreateSkill {

  name = "nya__liuli",

  tags = {  },

}



nya__liuli:addEffect(fk.TargetConfirming, {
  name = "nya__liuli",
  anim_type = "defensive",
  events = {fk.TargetConfirming},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(nya__liuli.name) and data.card.trueName == "slash" and
      table.find(player.room.alive_players, function(p)
        return p ~= player and p.id ~= data.from and player:inMyAttackRange(p) and
          not player.room:getPlayerById(data.from):isProhibited(p, data.card) end)
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local targets = {}
    local from = room:getPlayerById(data.from)
    for _, p in ipairs(room.alive_players) do
      if p ~= player and p.id ~= data.from and player:inMyAttackRange(p) and not from:isProhibited(p, data.card) then
        table.insert(targets, p.id)
      end
    end
    local n = not player:hasSkill("nya__play", true) and 2 or 1
    local tos, card = room:askForChooseCardAndPlayers(player, targets, 1, n, nil,
      "#nya__liuli-choose:::"..n..":"..data.card:toLogString(), nya__liuli.name, true)
    if #tos > 0 then
      event:setCostData(self, {tos, card})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:throwCard(event:getCostData(self)[2], nya__liuli.name, player, player)
    TargetGroup:removeTarget(data.targetGroup, player.id)
    for _, id in ipairs(event:getCostData(self)[1]) do
      room:doIndicate(player.id, {id})
      TargetGroup:pushTargets(data.targetGroup, id)
    end
  end,
})

return nya__liuli